package Negocio;

import static org.junit.Assert.*;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;

import org.junit.Test;

public class DepartamentoTest {


	@Test
	public void testCadastros() throws FileNotFoundException, IOException, ClassNotFoundException{

		Departamento dep=new Departamento();

		Professor prof1,prof2,prof3; 
		List<Professor> professores;

		assertTrue(dep.getListaProf().size()==0);    

		dep.cadastraProf("Ayla","123");

		assertTrue(dep.getListaProf().size()==1);

		assertEquals("Ayla",dep.getListaProf().get(0).getNome      ());
		assertEquals("123" ,dep.getListaProf ().get(0).getMatricula());

		dep=new Departamento();

		prof1=new Professor();
		prof1.setMatricula("12345");
		prof1.setNome("Ayla");


		prof2=new Professor();
		prof2.setMatricula("0000");
		prof2.setNome("Jessyca");


		prof3=new Professor();
		prof3.setMatricula("1010");
		prof3.setNome("Rodrigo");

		professores =new LinkedList<Professor>();
		professores.add(prof1);
		professores.add(prof2);
		professores.add(prof3);


		dep.cadastraDisciplina("ESA", "001", professores);
		assertTrue(dep.getDisciplina().size()==1);
		assertEquals("ESA",dep.getDisciplina().get(0).getNome  ());
		assertEquals("001",dep.getDisciplina().get(0).getCodigo());

		assertEquals("Ayla"   ,dep.getDisciplina().get(0).getProfessor().get(0).getNome     ());
		assertEquals("12345"  ,dep.getDisciplina().get(0).getProfessor().get(0).getMatricula());
		assertEquals("Jessyca",dep.getDisciplina().get(0).getProfessor().get(1).getNome     ());
		assertEquals("0000"   ,dep.getDisciplina().get(0).getProfessor().get(1).getMatricula());
		assertEquals("Rodrigo",dep.getDisciplina().get(0).getProfessor().get(2).getNome     ());
		assertEquals("1010"   ,dep.getDisciplina().get(0).getProfessor().get(2).getMatricula());


	}
}
